<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>分享书屋</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="icon" href="favicon2.ico">
    <link rel="stylesheet" href="${request.contextPath}/resources/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="${request.contextPath}/resources/css/index.css" media="all" />
</head>
<body class="main_body">
<div class="layui-layout layui-layout-admin">
    <!-- 顶部 -->
    <div class="layui-header header">
        <div class="layui-main mag0">
            <a href="#" class="logo">分享书屋系统</a>
            <!-- 显示/隐藏菜单 -->
            <a href="javascript:;" class="seraph hideMenu icon-caidan"></a>
            <ul class="layui-nav topLevelMenus" pc>
                <li class="layui-nav-item layui-this" data-menu="contentManagement">
                    <a href="javascript:;"><i class="layui-icon" data-icon="&#xe63c;">&#xe63c;</i><cite>内容管理</cite></a>
                </li>
            </ul>
            <!-- 顶部右侧菜单 -->
            <ul class="layui-nav top_menu">
                <li class="layui-nav-item" pc>
                    <a href="javascript:;" class="clearCache"><i class="layui-icon" data-icon="&#xe640;">&#xe640;</i><cite>清除缓存</cite><span class="layui-badge-dot"></span></a>
                </li>
                <li class="layui-nav-item" id="userInfo">
                    <a href="javascript:;"><img src="${request.contextPath}/resources/images/face.jpg" class="layui-nav-img userAvatar" width="35" height="35"><cite class="adminName"></cite></a>
                    <dl class="layui-nav-child">
                        <dd ><a href="javascript:void(0);" id="updatePassword"><i class="seraph icon-xiugai" data-icon="icon-xiugai"></i><cite>修改密码</cite></a></dd>
                        <dd pc><a href="javascript:void(0);" class="changeSkin"><i class="layui-icon">&#xe61b;</i><cite>更换皮肤</cite></a></dd>
                        <dd ><a href="javascript:void(0);" class="signOut" id="logout"><i class="seraph icon-tuichu"></i><cite>退出</cite></a></dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>
    <!-- 左侧导航 -->
    <div class="layui-side layui-bg-black">
        <div class="user-photo">
            <a class="img" title="我的头像" ><img src="${request.contextPath}/resources/images/face.jpg" class="userAvatar"></a>
            <p>你好！
                <span class="userName">${username}</span>
            , 欢迎登录</p>
        </div>
        <div class="navBar layui-side-scroll" id="navBar">
            <ul class="layui-nav layui-nav-tree">
                <li class="layui-nav-item layui-this">
                    <a href="https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=d&word=%E4%B9%A6%E5%B1%8B&hs=2&pn=9&spn=0&di=3520&pi=0&rn=1&tn=baiduimagedetail&is=0%2C0&ie=utf-8&oe=utf-8&cl=2&lm=-1&cs=1769067359%2C1712418335&os=2089883534%2C2910012183&simid=3564907229%2C484948851&adpicid=0&lpn=0&ln=30&fr=ala&fm=&sme=&cg=&bdtype=0&oriquery=%E4%B9%A6%E5%B1%8B&objurl=https%3A%2F%2Fgimg2.baidu.com%2Fimage_search%2Fsrc%3Dhttp%3A%2F%2Fimg.mp.itc.cn%2Fupload%2F20170723%2F504dea5ff5404c9c9d18d4e1426c74b9_th.jpg%26refer%3Dhttp%3A%2F%2Fimg.mp.itc.cn%26app%3D2002%26size%3Df9999%2C10000%26q%3Da80%26n%3D0%26g%3D0n%26fmt%3Djpeg%3Fsec%3D1624182748%26t%3Dbe9ab6a69eb63bc4a41d186581982669&fromurl=ippr_z2C%24qAzdH3FAzdH3F4p_z%26e3Bf5i7_z%26e3Bv54AzdH3Fda80a0dnAzdH3Fgcancam9mb_z%26e3Bfip4s&gsm=3&islist=&querylist=" data-url="page/main.html"><i class="layui-icon" data-icon=""></i><cite>后台首页</cite></a>
                </li>
            </ul>
        </div>
    </div>
    <!-- 右侧内容 -->
    <div class="layui-body layui-form">
        <div class="layui-tab mag0" lay-filter="bodyTab" id="top_tabs_box">
            <ul class="layui-tab-title top_tab" id="top_tabs">
                <li class="layui-this" lay-id=""><i class="layui-icon" >&#xe68e;</i> <cite>后台首页</cite></li>
            </ul>
            <ul class="layui-nav closeBox">
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon caozuo">&#xe643;</i> 页面操作</a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:;" class="refresh refreshThis"><i class="layui-icon">&#x1002;</i> 刷新当前</a></dd>
                        <dd><a href="javascript:;" class="closePageOther"><i class="seraph icon-prohibit"></i> 关闭其他</a></dd>
                        <dd><a href="javascript:;" class="closePageAll"><i class="seraph icon-guanbi"></i> 关闭全部</a></dd>
                    </dl>
                </li>
            </ul>
            <div class="layui-tab-content clildFrame">
                <div class="layui-tab-item layui-show">
                    <iframe src="https://www.8zt.cc/"></iframe>
                </div>
            </div>
        </div>
    </div>
    <!-- 底部  https://www.dushu.com/daohang/ -->
    <div class="layui-footer footer">
        <p><span>好读书，读好书</span>　　</p>
    </div>
</div>

<!-- 移动导航 -->
<div class="site-tree-mobile"><i class="layui-icon">&#xe602;</i></div>
<div class="site-mobile-shade"></div>
<script>
    /* 全局项目根路径 */
    var cxt = "${request.contextPath}";

</script>
<script type="text/javascript" src="${request.contextPath}/resources/layui/layui.js"></script>
<script type="text/javascript" src="${request.contextPath}/resources/js/index.js"></script>
<script type="text/javascript" src="${request.contextPath}/resources/js/cache.js"></script>
<script type="text/html" id="updatePasswordTpl" >
    <form class="layui-form layui-form-pane" style="margin-top: 15px;margin-left: 15px">
        <div class="layui-form-item">
            <label class="layui-form-label">
                原密码
            </label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="password" autocomplete="off"  lay-verify="required" lay-reqText="原密码不能为空" >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                新密码
            </label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="newPassword"  autocomplete="off"  lay-verify="required" lay-reqText="新密码不能为空">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                确认密码
            </label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="confirmPassword"  autocomplete="off" lay-verify="required" lay-reqText="确认密码不能为空">
            </div>
        </div>
        <button id="subBtn" lay-filter="subBtnFilter" lay-submit type="button" style="display: none"></button>
    </form>


</script>
<script>

    layui.use(['layer','jquery','form'],function (){
        let layer = layui.layer;
        let $ = layui.jquery;
        let form = layui.form;

        $("#logout").click(function (){
            console.log('dfgdxgxgxgx');
            $.get(cxt+"/sysuser/logout.do",function (rs){
                layer.msg(rs.msg);
                if(rs.code != 200){
                    return false;
                }
                location.href = cxt+"/index.jsp";
            });
        });

        $("#updatePassword").click(function(){
            alert("aaa")
            let layerOpt = {
                title:"修改密码",
                type:1,
                content:$("#updatePasswordTpl").html(),
                area:['330px','400px'],
                btn:['确认','取消'],
                btnAlign:'c',
                anim:4,
                success:function (layero,index){
                    //设置表单提交监听事件
                    form.on("submit(subBtnFilter)",function (d){
                        let formData = d.field;
                        //对比新密码和确认密码是否一致
                        let p1 = formData.newPassword;
                        let p2 = formData.confirmPassword;
                        if(p1 != p2){
                            layer.msg("新密码和确认密码不一致!");
                            return  false;
                        }
                        //进行ajax提交
                        $.post(cxt+"/sysuser/updatePassword.do",formData,function (rs){
                            layer.msg(rs.msg);
                            if(rs.code != 200){
                                return false;
                            }
                            layer.alert("请退出,重新登录!",function (index){
                                $.get(cxt+"/sysuser/logout.do",function (rs){
                                    layer.msg(rs.msg);
                                    if(rs.code != 200){
                                        return false;
                                    }
                                    location.href = cxt+"/index.jsp";
                                });
                            })
                            setTimeout(function (){
                                $.get(cxt+"/sysuser/logout.do",function (rs){
                                    layer.msg(rs.msg);
                                    if(rs.code != 200){
                                        return false;
                                    }
                                    location.href = cxt+"/index.jsp";
                                });
                            },3000);
                        });

                        return false;//阻止默认提交行为
                    });
                },
                yes:function (index,layero){
                    $("#subBtn").click();
                }
            };
            layer.open(layerOpt);
        });


    })


</script>
</body>
</html>